package org.flower.service.impl;

import org.apache.ibatis.session.SqlSession;
import org.flower.bean.OrderState;
import org.flower.mapper.OrderStateMapper;
import org.flower.service.OrderStateService;
import org.flower.utils.MyBatisUtil;

import java.io.IOException;
import java.util.List;

/**
 * 订单状态服务impl
 *
 * @author Aizen
 * @date 2021/12/25
 */
public class OrderStateServiceImpl implements OrderStateService {
    @Override
    public List<OrderState> findAllState() {
        try {
            SqlSession sqlSessionFactory = MyBatisUtil.getSqlSessionFactory();
            OrderStateMapper mapper = sqlSessionFactory.getMapper(OrderStateMapper.class);
            List<OrderState> orderStates = mapper.findAll();
            sqlSessionFactory.close();
            return orderStates;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
